package com.kitchen.beans.utils;

import java.util.Base64;

public class Base64Utils {
    //加密
    public static String encode(String msg){
        return Base64.getEncoder().encodeToString(msg.getBytes());
    }
    //解密
    public static String decode(String msg){
        return new String(Base64.getDecoder().decode(msg));
    }
    public static void main(String[] args) {
        final String encode = Base64Utils.encode("123456");
        System.out.println(encode);

        final String old = Base64Utils.decode(encode);
        System.out.println(old);
    }
}
